Integrand size = 23, antiderivative size = 415 \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=-\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {b \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}-\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}+\frac {b \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}+\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d} \]
[Out]
Time = 0.68 (sec) , antiderivative size = 415, normalized size of antiderivative = 1.00, number of steps used = 16, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.522, Rules used = {3649, 3734, 3566, 714, 1143, 648, 632, 212, 642, 3715, 65, 214} \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=-\frac {b \text {arctanh}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}-\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}+\frac {b \text {arctanh}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}+\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {b \log \left (-\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \tan (c+d x)}+\sqrt {a^2+b^2}+a+b \tan (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}+\frac {b \log \left (\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \tan (c+d x)}+\sqrt {a^2+b^2}+a+b \tan (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}-\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d} \]
[In]
[Out]
Rule 65
Rule 212
Rule 214
Rule 632
Rule 642
Rule 648
Rule 714
Rule 1143
Rule 3566
Rule 3649
Rule 3715
Rule 3734
Rubi steps \begin{align*} \text {integral}& = -\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}-\int \frac {\cot (c+d x) \left (-\frac {b}{2}+a \tan (c+d x)+\frac {1}{2} b \tan ^2(c+d x)\right )}{\sqrt {a+b \tan (c+d x)}} \, dx \\ & = -\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}+\frac {1}{2} b \int \frac {\cot (c+d x) \left (1+\tan ^2(c+d x)\right )}{\sqrt {a+b \tan (c+d x)}} \, dx-\int \sqrt {a+b \tan (c+d x)} \, dx \\ & = -\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}+\frac {b \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\tan (c+d x)\right )}{2 d}-\frac {b \text {Subst}\left (\int \frac {\sqrt {a+x}}{b^2+x^2} \, dx,x,b \tan (c+d x)\right )}{d} \\ & = -\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}+\frac {\text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{d}-\frac {(2 b) \text {Subst}\left (\int \frac {x^2}{a^2+b^2-2 a x^2+x^4} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{d} \\ & = -\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}-\frac {b \text {Subst}\left (\int \frac {x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \text {Subst}\left (\int \frac {x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \\ & = -\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}-\frac {b \text {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{2 d}-\frac {b \text {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{2 d}-\frac {b \text {Subst}\left (\int \frac {-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \text {Subst}\left (\int \frac {\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d} \\ & = -\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d}+\frac {b \text {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \tan (c+d x)}\right )}{d}+\frac {b \text {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \tan (c+d x)}\right )}{d} \\ & = -\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-\frac {b \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}-\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}+\frac {b \text {arctanh}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}+\sqrt {2} \sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \log \left (a+\sqrt {a^2+b^2}+b \tan (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \tan (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d} \\ \end{align*}
Result contains complex when optimal does not.
Time = 0.81 (sec) , antiderivative size = 139, normalized size of antiderivative = 0.33 \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=-\frac {\frac {b \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a}}-i \sqrt {a-i b} \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a-i b}}\right )+i \sqrt {a+i b} \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a+i b}}\right )+\cot (c+d x) \sqrt {a+b \tan (c+d x)}}{d} \]
[In]
[Out]
result has leaf size over 500,000. Avoiding possible recursion issues.
Time = 34.82 (sec) , antiderivative size = 1278502, normalized size of antiderivative = 3080.73
\[\text {output too large to display}\]
[In]
[Out]
none
Time = 0.29 (sec) , antiderivative size = 847, normalized size of antiderivative = 2.04 \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=\left [\frac {a d \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \log \left (d^{3} \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) - a d \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \log \left (-d^{3} \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) - a d \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \log \left (d^{3} \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) + a d \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \log \left (-d^{3} \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) + \sqrt {a} b \log \left (\frac {b \tan \left (d x + c\right ) - 2 \, \sqrt {b \tan \left (d x + c\right ) + a} \sqrt {a} + 2 \, a}{\tan \left (d x + c\right )}\right ) \tan \left (d x + c\right ) - 2 \, \sqrt {b \tan \left (d x + c\right ) + a} a}{2 \, a d \tan \left (d x + c\right )}, \frac {a d \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \log \left (d^{3} \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) - a d \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \log \left (-d^{3} \sqrt {-\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} + a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) - a d \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \log \left (d^{3} \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) + a d \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \log \left (-d^{3} \sqrt {\frac {d^{2} \sqrt {-\frac {b^{2}}{d^{4}}} - a}{d^{2}}} \sqrt {-\frac {b^{2}}{d^{4}}} + \sqrt {b \tan \left (d x + c\right ) + a} b\right ) \tan \left (d x + c\right ) + 2 \, \sqrt {-a} b \arctan \left (\frac {\sqrt {b \tan \left (d x + c\right ) + a} \sqrt {-a}}{a}\right ) \tan \left (d x + c\right ) - 2 \, \sqrt {b \tan \left (d x + c\right ) + a} a}{2 \, a d \tan \left (d x + c\right )}\right ] \]
[In]
[Out]
\[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=\int \sqrt {a + b \tan {\left (c + d x \right )}} \cot ^{2}{\left (c + d x \right )}\, dx \]
[In]
[Out]
\[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=\int { \sqrt {b \tan \left (d x + c\right ) + a} \cot \left (d x + c\right )^{2} \,d x } \]
[In]
[Out]
Timed out. \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=\text {Timed out} \]
[In]
[Out]
Time = 4.90 (sec) , antiderivative size = 832, normalized size of antiderivative = 2.00 \[ \int \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)} \, dx=\mathrm {atan}\left (-\frac {b^{12}\,\sqrt {-\frac {a}{4\,d^2}-\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,32{}\mathrm {i}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}+\frac {a\,b^{12}\,16{}\mathrm {i}}{d}+\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}+\frac {64\,a\,b^{11}\,\sqrt {-\frac {a}{4\,d^2}-\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}+\frac {a\,b^{12}\,16{}\mathrm {i}}{d}+\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}+\frac {32\,a^3\,b^9\,\sqrt {-\frac {a}{4\,d^2}-\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}+\frac {a\,b^{12}\,16{}\mathrm {i}}{d}+\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}\right )\,\sqrt {-\frac {a+b\,1{}\mathrm {i}}{4\,d^2}}\,2{}\mathrm {i}-\mathrm {atan}\left (\frac {b^{12}\,\sqrt {-\frac {a}{4\,d^2}+\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,32{}\mathrm {i}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}-\frac {a\,b^{12}\,16{}\mathrm {i}}{d}-\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}+\frac {64\,a\,b^{11}\,\sqrt {-\frac {a}{4\,d^2}+\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}-\frac {a\,b^{12}\,16{}\mathrm {i}}{d}-\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}+\frac {32\,a^3\,b^9\,\sqrt {-\frac {a}{4\,d^2}+\frac {b\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}}{\frac {16\,b^{13}}{d}+\frac {32\,a^2\,b^{11}}{d}+\frac {16\,a^4\,b^9}{d}-\frac {a\,b^{12}\,16{}\mathrm {i}}{d}-\frac {a^3\,b^{10}\,16{}\mathrm {i}}{d}}\right )\,\sqrt {-\frac {a-b\,1{}\mathrm {i}}{4\,d^2}}\,2{}\mathrm {i}+\frac {b\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}}{a\,d-d\,\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}+\frac {b\,\mathrm {atan}\left (\frac {b^{13}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,128{}\mathrm {i}}{\sqrt {a}\,\left (128\,b^{13}+128\,a^2\,b^{11}+32\,a^4\,b^9+\frac {32\,b^{15}}{a^2}\right )}+\frac {a^{3/2}\,b^{11}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,128{}\mathrm {i}}{128\,b^{13}+128\,a^2\,b^{11}+32\,a^4\,b^9+\frac {32\,b^{15}}{a^2}}+\frac {a^{7/2}\,b^9\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,32{}\mathrm {i}}{128\,b^{13}+128\,a^2\,b^{11}+32\,a^4\,b^9+\frac {32\,b^{15}}{a^2}}+\frac {b^{15}\,\sqrt {a+b\,\mathrm {tan}\left (c+d\,x\right )}\,32{}\mathrm {i}}{a^{5/2}\,\left (128\,b^{13}+128\,a^2\,b^{11}+32\,a^4\,b^9+\frac {32\,b^{15}}{a^2}\right )}\right )\,1{}\mathrm {i}}{\sqrt {a}\,d} \]
[In]
[Out]